//
//  ILGRequest.h
//  ILGLibProjectDEV
//
//  Created by Happy on 8/27/16.
//  Copyright © 2016 Happy. All rights reserved.
//

#import <Foundation/Foundation.h>

#if __has_include("AFNetworking.h")
#import "AFNetworking.h"
#define ILGAFNetworking
#endif

typedef void(^ILGRequestSuccess)(NSDictionary *dic);
typedef void(^ILGRequestFailure)(NSError *error);
typedef void(^RequestSuccess)(NSDictionary *dic);
typedef void(^RequestFailure)(NSError *error);

typedef NS_ENUM(NSInteger, ILGRequestSerializer) {
    ILGRequestSerializerJSON,
    ILGRequestSerializerHTTP
};

typedef NS_ENUM(NSInteger, ILGResponseSerializer) {
    ILGResponseSerializerJSON,
    ILGResponseSerializerHTTP
};

@interface ILGRequest : NSObject

- (id)initWithBaseURL:(NSString *)baseURL;

- (void)setRequestSerializer:(ILGRequestSerializer)requestSerializer;

- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field;

+ (void)get:(NSString *)URLString parameter:(NSDictionary *)parameter success:(ILGRequestSuccess)success failure:(ILGRequestFailure)failure;
+ (void)post:(NSString *)URLString parameter:(NSDictionary *)parameter success:(ILGRequestSuccess)success failure:(ILGRequestFailure)failure;

- (void)get:(NSString *)URLString parameter:(NSDictionary *)parameter success:(ILGRequestSuccess)success failure:(ILGRequestFailure)failure;

- (void)post:(NSString *)URLString parameter:(NSDictionary *)paramter success:(ILGRequestSuccess)success failure:(ILGRequestFailure)failure;
- (void)POST:(NSString *)URLString parameters:(NSDictionary *)parameters constructingBodyWithBlock:(void(^)(id<AFMultipartFormData>  _Nonnull formData))block progress:(void(^)(NSProgress * _Nonnull uploadProgress))progress success:(ILGRequestSuccess)success failure:(ILGRequestFailure)failure;

- (void)DELETE:(NSString *)URLString parameters:(NSDictionary *)parameters success:(ILGRequestSuccess)success failure:(ILGRequestFailure)failure;

- (void)uploadPicture:(NSString *)URLString params:(NSDictionary *)params imageArr:(NSArray<UIImage *> *)imageArr nameArr:(NSArray *)nameArr fileNameArr:(NSArray *)fileNameArr success:(ILGRequestSuccess)success failure:(ILGRequestFailure)failure;

@end


@interface ILGRequest (NetworkReachability)

+ (void)startMonitoring;
+ (void)setReachabilityStatusChangeBlock:(void (^)(NSInteger status))block;

@end
